package es.android.holamundo;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

public class HolaMundoActivity extends Activity {//Una actividad extendera activity
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);//se accede al recurso a traves de la clase R
        
        
        //Vamos a declarar un boton, para interactuar con valida
        Button button =  (Button) findViewById(R.id.botonValidar);
        
        button.setOnClickListener(new View.OnClickListener() {
		TextView textViewPassword1 = (TextView) findViewById(R.id.editTextPassword);
		TextView textViewPassword2 = (TextView) findViewById(R.id.editTextRepite);
		
			@Override
			public void onClick(View v) {
				if(textViewPassword1.getText().toString().equals(textViewPassword2.getText().toString()))
					showText("Correcto!");
					
				else
					showText("Incorrecto!");
			}     
        });
        
		}   
		public void showText(String s) {
			Toast.makeText(this, s, Toast.LENGTH_SHORT).show();	
		
    }
}